//
//  PlayVideoViewController.m
//  Video Demo
//
//  Created by cluy on 14-8-12.
//  Copyright (c) 2014年 yangdan. All rights reserved.
//

#import "PlayVideoViewController.h"

@interface PlayVideoViewController ()

@end

@implementation PlayVideoViewController


- (void)viewDidLoad
{
    self.view.frame = CGRectMake(0, 0, 1024, 768);
    NSString *str = [[NSBundle mainBundle]pathForResource:@"test" ofType:@"mp4"];
    NSURL *url = [NSURL fileURLWithPath:str];
    playControl = [[MPMoviePlayerController alloc]initWithContentURL:url];
    playControl.scalingMode=MPMovieScalingModeAspectFit;
    playControl.controlStyle=MPMovieControlModeHidden;
    playControl.view.frame = self.view.frame;
    [self.view addSubview:playControl.view];
    playControl.fullscreen = YES;
    [playControl play];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(exitPlay)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:nil];

}

-(void)exitPlay
{
   [self dismissViewControllerAnimated:YES completion:^{
     
   }];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation ==UIInterfaceOrientationLandscapeRight);
}

    



@end
